package dlg.code.state.service.impl;

import dlg.code.state.context.OrderStateContext;
import dlg.code.state.domain.OrderInfo;
import dlg.code.state.service.IOrderService;
import dlg.code.state.context.service.IOrderStateService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class OrderServiceImpl implements IOrderService {

    private final static Logger log = LoggerFactory.getLogger(OrderServiceImpl.class);

    @Override
    public boolean pay(OrderInfo orderInfo) {
        IOrderStateService orderStateService = OrderStateContext.getOrderStateService(orderInfo);
        boolean pay = orderStateService.pay(orderInfo);
        return pay;
    }

    @Override
    public boolean reminder(OrderInfo orderInfo) {
        IOrderStateService orderStateService = OrderStateContext.getOrderStateService(orderInfo);
        orderStateService.reminder(orderInfo);
        return true;
    }

    @Override
    public boolean delete(OrderInfo orderInfo) {
        return false;
    }

//    @Override
//    public void changeState(OrderInfo orderInfo, OrderStateEnum orderStateEnum) {
//        log.info("订单 {} 由状态 {} 转为 {}", orderInfo.getId(), orderInfo.getOrderStateEnum().getName(), orderStateEnum.getName());
//        orderInfo.setOrderStateEnum(orderStateEnum);
//    }

}
